<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        *{
            margin:0;
            padding:0;
        }
    ul{
        width:800px;
        height: 420px;
        list-style: none;
        margin:100px auto;
    }
    div{
        width:800px;
        height: 100px;
        border-bottom:1px solid black;
        text-align: center;
        font-size:50px;
    }
    li{
        width:160px;
        height:160px;
        float:left;
    }
    img{
        width:158px;
        height:158px;
        float:left;
        position:absolute;
        border: 1px solid black;
    }
    section{
        width:160px;
        height:160px;
        float:left;
        position:absolute;
        text-align: center;
        line-height: 160px;
        font-size: 40px;
        border:1px solid black;
    }
    .current{
        display:none;
    }
    </style>
</head>
<body>
    <ul>
        <div>斗图大会</div>
        <li><img class="current" src="帅1.jpg" alt="#"><section>搞笑吧</section></li>
        <li><img class="current" src="帅2.jpg" alt="#"><section>搞笑吧</section></li>
        <li><img class="current" src="帅3.jpg" alt="#"><section>搞笑吧</section></li>
        <li><img class="current" src="帅4.jpg" alt="#"><section>搞笑吧</section></li>
        <li><img class="current" src="帅5.jpg" alt="#"><section>搞笑吧</section></li>
        <li><img class="current" src="帅6.jpg" alt="#"><section>搞笑吧</section></li>
        <li><img class="current" src="帅7.jpg" alt="#"><section>搞笑吧</section></li>
        <li><img class="current" src="帅8.jpg" alt="#"><section>搞笑吧</section></li>
        <li><img class="current" src="帅9.jpg" alt="#"><section>搞笑吧</section></li>
        <li><img class="current" src="帅10.jpg" alt="#"><section>搞笑吧</section></li>
    </ul>
</body>
</html>
<script>
    var section = document.querySelectorAll("section");
    var img = document.querySelectorAll("img");
    console.log(section);
    for(var i=0;i<section.length;i++){
        section[i].index=i;
        section[i].onmouseover=function(){
             img[this.index].className="";
             section[this.index].className="current";
            // console.log(this.index);
        }
        section[i].onmouseout=function(){
             img[this.index].className="current";
            section[this.index].className="";
        }
    }
    
</script>